#define _CRT_SECURE_NO_WARNINGS 1



/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* masterMind(char* solution, char* guess, int* returnSize) {
    static int ret[2] = { 0 };
    ret[0] = 0; ret[1] = 0;
    *returnSize = 2;
    int rjkp = 0;
    int wrjkp = 0;
    int rarr[26] = { 0 };
    int wrarr[26] = { 0 };
    for (int i = 0; i < 4; ++i)
    {
        if (guess[i] == solution[i])
        {
            ++ret[0];
        }
        else
        {
            rarr[solution[i] - 'A']++;
            //printf("%d\n",rarr[solution[i]-'A']);
            wrarr[guess[i] - 'A']++;
            //printf("%d\n",wrarr[solution[i]-'A']);

        }
    }
    int rcount = 0;
    int wrcount = 0;
    for (int i = 0; i < 26; ++i)
    {
        ret[1] += rarr[i] > wrarr[i] ? wrarr[i] : rarr[i];
    }
    return ret;
}